<template>
    <div ref="chart" style="width: 100%; height: 400px;"></div>
  </template>
  
  <script>
  import echarts from 'echarts';
  
  export default {
    props: {
      option: {
        type: Object,
        required: true,
      },
    },
    mounted() {
      this.chart = echarts.init(this.$refs.chart);
      this.chart.setOption(this.option);
    },
    beforeDestroy() {
      this.chart.dispose();
    },
  };
  </script>
  